<script type="text/javascript">const responseFromLicense = {{ site.data.license.response | jsonify }}; const pageLang = '{{ page.lang }}';</script>
<script type="text/javascript" src='{{ assets["getting-started.js"].digest_path }}'></script>
{% if page.platform_code == "bm-private" -%}
  <script type="text/javascript" src='{{ assets["getting-started-private.js"].digest_path }}'></script>
  {%- include getting_started/global/partials/NOTICES.liquid %}
{% endif %}
<script type="text/javascript" src='{{ assets["getting-started-install.js"].digest_path }}'></script>
<script type="text/javascript" src='{{ assets["bcrypt.js"].digest_path }}'></script>

<span style="display: none" id="platform_code">{{page.platform_code}}</span>

{%- assign layout = site.data.getting_started.data.installTypes[page.platform_code].layout %}
{% unless page.ee_only == true or page.platform_code == "bm-private" -%}
{% if page.lang == 'ru' %}
#### Выберите редакцию Deckhouse Kubernetes Platform
{% else %}
#### Select the Deckhouse Kubernetes Platform revision
{% endif %}
<div class="tabs">
    {%- for revision in site.data.getting_started.data.global.revisions %}
        <a id='tab_layout_{{ revision }}' href="javascript:void(0)" class="tabs__btn tabs__btn_revision{% if revision == 'ce' %} active{% endif %}"
        onclick="openTabAndSaveStatus(event, 'tabs__btn_revision', 'tabs__content_revision', 'block_layout_{{ revision }}', 'dhctl-revision', '{{ revision }}');
                 openTabAndSaveStatus(event, 'tabs__btn_revision', 'tabs__content_other', 'block_other_{{ revision }}');
                 toggleDisabled('tab_layout_{{ revision }}', '[license-token]');" >
        {{ site.data.i18n[revision] }}
        </a>
    {%- endfor %}
</div>
{%- endunless %}

{%- for revision in site.data.getting_started.data.global.revisions %}
{%- if page.ee_only == true and revision == 'ce' %}{% continue %}{% endif %}
{%- if page.ce_only == true and revision == 'ee' %}{% continue %}{% endif %}
{% assign layoutCode = '' | append: layout.code %}
<div id='block_layout_{{ revision }}' class="tabs__content tabs__content_revision{% if revision == 'ce' or page.ee_only == true %} active{% endif %}" markdown="1">
    {% if page.lang == 'ru' %}
    {% include getting_started/global/partials/INSTALL_CONFIG_RU.liquid revision=revision layout=layoutCode %}
    {% else %}
    {% include getting_started/global/partials/INSTALL_CONFIG.liquid revision=revision layout=layoutCode %}
    {% endif %}
</div>
{%- endfor %}

<div class="dimmer-block-content common" markdown="1">

{% if page.platform_type == 'cloud' %}
{% if page.lang == 'ru' %}
Создайте файл `resources.yml`.
{% else %}
Create the `resources.yml` file.
{% endif %}

{% snippetcut name="resources.yml" selector="resources-yml" %}
{% include_file "_includes/getting_started/{{ page.platform_code }}/partials/resources.yml.minimal.inc" syntax="yaml" %}
{% endsnippetcut %}
{% endif %}

</div>

{%- for revision in site.data.getting_started.data.global.revisions %}
{%- if revision =='ce' and page.ee_only == true %}{% continue %}{% endif %}

{% if revision == 'ee' %}
<div class="dimmer-block-content">
{% endif %}

<div id='block_other_{{ revision }}' class="tabs__content tabs__content_other{% if revision == 'ce' or page.ee_only == true %} active{% endif %}" markdown="1">
{% if page.lang == 'ru' %}
{% include getting_started/global/partials/INSTALL_OTHER_RU.liquid revision=revision %}
{% else %}
{% include getting_started/global/partials/INSTALL_OTHER.liquid revision=revision %}
{% endif %}
</div>
{% if revision == 'ee' %}
</div>
{% endif %}

{% endfor %}

<script>
$(document).ready(function() {
  $.cookie('lang', '{{ page.lang }}');
  $('#enter-license-key').click((e)=> {
    e.preventDefault();
    let licenseToken = $('[license-token]').val()
    getLicenseToken(licenseToken)
  });

  $('[license-token]').keypress((e) => {
      const keycode = (event.keyCode ? event.keyCode : event.which);
      let licenseToken = $('[license-token]').val()
      if (keycode == '13') {
        getLicenseToken(licenseToken)
      }
  });

  triggerBlockOnItemContent('[license-token]', '.dimmer-block-content', {% if page.ee_only != true %}true{% endif %});

  generate_password(true);
  replace_snippet_password();
  sessionStorage.setItem('dhctl-revision','{% if page.ee_only == true %}ee{% else %}ce{% endif %}');
});
</script>
